<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<link rel="stylesheet" href="/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style>
</style>
	</ui:define>
	<ui:define name="content">
		<div class='full-center-content-scroll-noheader'>
			<h:form id="form3">
				<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
					<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
					<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
				</p:confirmDialog>
				<p:growl id="msgs" showDetail="true" />
				<p:toolbar id="btnBar">
					<f:facet name="left">
						<p:commandButton value="编辑" id="editBtn"
							disabled="#{delayMessageMaintainController.selected==null}" oncomplete="PF('editDlg').show()"
							rendered="#{s:hasPermission(session,'xtsz_gjxxwh_bj')}" process="@this"
							update="editForm:editDlg  " icon="fa fa-pencil" />
						<p:commandButton value="删除" id="delBtn"
							disabled="#{delayMessageMaintainController.selected==null}"
							rendered="#{s:hasPermission(session,'xtsz_gjxxwh_sc')}"
							actionListener="#{delayMessageMaintainController.delete}"
							update="form3:msgs form3:dataTb form3:delBtn form3:editBtn "
							icon="fa fa-trash">
							<p:confirm header="提示" message="确定要删除么？" icon="ui-icon-alert" />
						</p:commandButton>
					</f:facet>
				</p:toolbar>
				<p:dataTable id="dataTb" var="messages" emptyMessage="无记录" rowIndexVar="ite"
					value="#{delayMessageMaintainController.delayList}" rowKey="#{messages.id}"
					selection="#{delayMessageMaintainController.selected}" rows="20" paginator="true" lazy="true"
					paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="20,50,100" paginatorPosition="bottom">
					<f:facet name="{Customization}">
						<p:outputLabel value="总计：#{delayMessageMaintainController.delayList.size()} 条记录"
							style="margin-right:20px;" />
					</f:facet>
					<p:ajax event="rowSelectRadio" listener="#{delayMessageMaintainController.onRowSelect}"
						update="form3:btnBar" />
					<p:column selectionMode="single" style="text-align:center;width:60px" />
					<p:column width="60" headerText="序号">
						<h:outputText value="#{ite+1}" />
					</p:column>
					<p:column headerText="消息名称">
						<h:outputText value="#{messages.name}"/>
					</p:column>
					<p:column headerText="开始时间">
						<h:outputText value="#{messages.startTime}">
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
						</h:outputText>
					</p:column>
					<p:column headerText="延迟时间（毫秒）">
						<h:outputText value="#{messages.delayTime}"/>
					</p:column>
					<p:column headerText="过期时间">
						<h:outputText value="#{messages.expireTime}">
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
						</h:outputText>
					</p:column>
				</p:dataTable>
			</h:form>
			<h:form id="editForm">
				<p:dialog widgetVar="editDlg" header="编辑" modal="true" id="editDlg" width="600" height="400">
					<p:toolbar>
						<f:facet name="left">
							<p:commandButton id="createSaveBtn" value="保存" style="float: right;" icon="fa fa-floppy-o"
								update="form3:dataTb form3:msgs form3:editBtn "
								actionListener="#{delayMessageMaintainController.save}" oncomplete="PF('editDlg').hide()" />
						</f:facet>
					</p:toolbar>
					<p:outputPanel id="editDetail" style="width:100%;">
						<p:panelGrid style="width:100%">
						    <p:row>
								<p:column>
									<h:outputText value="名称" />
								</p:column>
								<p:column>
									<p:inputText value="#{delayMessageMaintainController.selected.name}" 
									readonly="true" id="name" style="width:100%" >
									</p:inputText>
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="开始时间" />
								</p:column>
								<p:column>
									<p:inputText value="#{delayMessageMaintainController.selected.startTime}" id="startTime"
										readonly="true" style="width:100%" >
									  <f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
									</p:inputText>
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="过期时间" />
								</p:column>
								<p:column>
									<p:inputText value="#{delayMessageMaintainController.selected.expireTime}"
									 readonly="true"	 id="secondary_id" style="width:100%">
										<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
									</p:inputText>
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="延迟时间（毫秒）" />
								</p:column>
								<p:column>
									<p:inputText value="#{delayMessageMaintainController.selected.delayTime}" id="delayTime"
										style="width:100%">
									</p:inputText>
								</p:column>
							</p:row>
							
						</p:panelGrid>
					</p:outputPanel>
				</p:dialog>
			</h:form>
		</div>
	</ui:define>
	<ui:define name="contentend">
		<script src="/resources/plugins/datatables/jquery.dataTables.js"></script>
		<script src="/resources/plugins/datatables/dataTables.bootstrap.min.js"></script>
		<script src="/resources/js/tables/mytable.js"></script>
		<script>
		</script>
	</ui:define>
</ui:composition>
